<template>
    <div>
        <el-dialog title="商品上架审批" 
            :visible.sync="show"
            append-to-body
            @close='closeEvt'
            >
            <el-form :model="form">
                <el-form-item label="编码：" :label-width="formLabelWidth">
                <el-input v-model="form.goods_id" autocomplete="off" disabled></el-input>
                </el-form-item>
                  <el-form-item label="审批人：" :label-width="formLabelWidth">
                <el-input v-model="form.user_name" autocomplete="off" disabled></el-input>
                </el-form-item>
                
                <el-form-item label="状态：" :label-width="formLabelWidth">
                <el-select v-model="form.stateValve">
                    <el-option label="通过" value="通过"></el-option>
                    <el-option label="驳回" value="驳回"></el-option>
                </el-select>
                </el-form-item>
                <el-form-item label="备注：" :label-width="formLabelWidth" >
                <el-input type='textarea' :autosize="{ minRows: 3, maxRows: 5}"  v-model="form.remark" autocomplete="off" maxlength="30" show-word-limit></el-input>
                </el-form-item>
            </el-form>
            <div slot="footer" class="dialog-footer">
                <el-button @click="show = false">取 消</el-button>
                <el-button type="primary" @click="approverEvt">确 定</el-button>
            </div>
        </el-dialog>
    </div>
</template>

<script>
import { productApproveApi, productListApi } from '../../../apis/productApi'
export default {
    props:{
         dataId:{
            type:Object,
            require:true,
        },
        value:{
            // type:Boolean,
            require:true,
        }
       
        
    },
    watch:{
        value(val){
            this.show = val
        }
    },
      data() {
      return {
        show:false,
        dialogFormVisible: false,
        form: {
            goods_id:'',
            user_name:'',
            stateValve:'通过',
            remark:'',
            user_id:"",
            state:''
        },
        formLabelWidth: '120px',
      }
    },
    methods:{
        closeEvt(){
            this.$emit('input',false)
        },
        async approverEvt(){
            this.show = false
            // let result = await productApproveApi(this.form)
        }, 
   
    },
    beforeUpdate(){
        let userInfo = this.$store.getters['common/userInfo']
        this.form.user_name = userInfo.name
        this.form.user_id = userInfo.id
        this.form.goods_id = this.dataId.id
        this.form.stateValve === '通过' ? this.form.state = '1' : this.form.state = '0'
    }
}
</script>

<style lang='less' >
   .el-dialog__header{
        border-bottom:1px solid #efeeee;
    }
    .el-textarea__inner,
    .el-textarea{
         width:217px;
    }
</style>